{extend name="Base/base"/}

{block name="body"}
        <div class="main-title">
            <h2>优惠券详情            </h2>
        </div>
        <div class="with-padding">


            <div class="tab-wrap" style="margin-bottom: 5px">
                <ul class="nav nav-secondary group_nav">
                </ul>
            </div>
            <form action="/uctoo/admin.php?s=/shop/coupon/action/add.html" method="post" class="form-horizontal">
                <label class="item-label">编号    </label>
                <div class="controls ">
                    <input type="hidden" name="id" value="" class="text input-large form-control" style="width: 400px" placeholder="无需填写" readonly="">
                    <p class="lead"></p></div><label class="item-label">优惠券名称    </label>
                <div class="controls ">
                    <input type="text" name="title" value="" class="text input-large form-control" style="width: 400px"></div><label class="item-label">优惠券图片    </label>
                <div class="controls ">
                    <div class="controls">
                        <div id="upload_single_image_img" style="padding-bottom: 5px;" class="webuploader-container"><div class="webuploader-pick">选择图片</div><div id="rt_rt_1b4t1kpdp4c1ov7i0ionp19sb1" style="position: absolute; top: 0px; left: 0px; width: 64px; height: 28px; overflow: hidden; bottom: auto; right: auto;"><input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*"><label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);"></label></div></div>
                        <input class="attach" type="hidden" name="img" value="">
                        <div class="upload-img-box">
                            <div class="upload-pre-item popup-gallery">

                            </div>
                        </div>
                    </div>
                    <script>
                        $(function () {
                            var uploader_img= WebUploader.create({
                                // 选完文件后，是否自动上传。
                                auto: true,
                                // swf文件路径
                                swf: 'Uploader.swf',
                                // 文件接收服务端。
                                server: "/uctoo/admin.php?s=/file/uploadpicture/session_id/us4q6e0illvfrr7upl0rdh23e3.html",
                                // 选择文件的按钮。可选。
                                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                                pick: '#upload_single_image_img',
                                // 只允许选择图片文件
                                accept: {
                                    title: 'Images',
                                    extensions: 'gif,jpg,jpeg,bmp,png',
                                    mimeTypes: 'image/*'
                                }
                            });
                            uploader_img.on('fileQueued', function (file) {
                                uploader_img.upload();
                            });
                            /*上传成功**/
                            uploader_img.on('uploadSuccess', function (file, data) {
                                if (data.status) {
                                    $("[name='img']").val(data.id);
                                    $("[name='img']").parent().find('.upload-pre-item').html(
                                        ' <div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                                    );
                                    uploader_img.reset();
                                } else {
                                    updateAlert(data.info);
                                    setTimeout(function () {
                                        $('#top-alert').find('button').click();
                                        $(that).removeClass('disabled').prop('disabled', false);
                                    }, 1500);
                                }
                            });
                        })
                    </script></div><label class="item-label">总发放数量    </label>
                <div class="controls ">
                    <input type="text" name="publish_cnt" value="" class="text input-large form-control" style="width: 400px"></div><label class="item-label">优惠金额    <span class="check-tips">（单位：分）</span></label>
                <div class="controls ">
                    <input type="text" name="discount" value="" class="text input-large form-control" style="width: 400px"></div><label class="item-label">有效期    </label>
                <div class="controls ">
                    <select name="duration" class="form-control" style="width:auto;">
                        <option value="0" selected="">永久有效</option>                <option value="86400">一天内有效</option>                <option value="604800">一周内有效</option>                <option value="2592000">一月内有效</option>        </select></div><label class="item-label">领取限制    <span class="check-tips">（每个用户最多允许领取多少张）</span></label>
                <div class="controls ">
                    <div class="clearfix" style="width:400px;">
                        <select name="max_cnt_enable" class="pull-left form-control" style="width:95px;margin-right:5px">
                            <option value="0" selected="">不限制</option>
                            <option value="1">限制</option>
                        </select>                <input type="text" name="max_cnt" value="" class=" pull-left text input-large form-control" style="width:95px;margin-right:5px" placeholder="">                </div></div><label class="item-label">领取限制    <span class="check-tips">（每个用户每天最多允许领取多少张）</span></label>
                <div class="controls ">
                    <div class="clearfix" style="width:400px;">
                        <select name="max_cnt_day_enable" class="pull-left form-control" style="width:95px;margin-right:5px">
                            <option value="0" selected="">不限制</option>
                            <option value="1">限制</option>
                        </select>                <input type="text" name="max_cnt_day" value="" class=" pull-left text input-large form-control" style="width:95px;margin-right:5px" placeholder="">                </div></div><label class="item-label">使用限制    <span class="check-tips">（最低可以使用的价格（单位：分），即满多少可用）</span></label>
                <div class="controls ">
                    <div class="clearfix" style="width:400px;">
                        <select name="min_price_enable" class="pull-left form-control" style="width:95px;margin-right:5px">
                            <option value="0" selected="">不限制</option>
                            <option value="1">限制</option>
                        </select>                <input type="text" name="min_price" value="" class=" pull-left text input-large form-control" style="width:95px;margin-right:5px" placeholder="">                </div></div><label class="item-label">类型    </label>
                <div class="controls ">
                    <select name="valuation" class="form-control" style="width:auto;">
                        <option value="0" selected="">现金券</option>                <option value="1">折扣券</option>        </select></div><label class="item-label">优惠券说明    </label>
                <div class="controls ">

                    <script id="brief" class="edui-default" style="width: 500px;">
                    </script>
                    <script>
                        var  ue_brief;
                        $(function () {
                            var config = {toolbars:[['source','|','bold','italic','underline','fontsize','forecolor','justifyleft','fontfamily','|','map','emotion','insertimage','insertcode']],zIndex:977,initialFrameWidth:500,initialFrameHeight:400,autoHeightEnabled: false,'topOffset':$('#nav_bar').height()+$('#sub_nav').height()+5};
                            ue_brief = UE.getEditor('brief', config);
                        })
                    </script>

                </div>
                <label class="item-label">创建时间    </label>
                <div class="controls ">
                    <input type="hidden" name="create_time" value="1482738525">
                    <input type="text" data-field-name="create_time" class="text input-large form-datetime time form-control" style="width: 400px" value="2016-12-26 15:48" placeholder="请选择时间"></div>                        <br>

                <div class="form-item">
                    <button class="btn submit-btn ajax-post btn-success" id="submit" type="submit" target-form="form-horizontal">确定</button>  &nbsp;<button onclick="javascript:history.back(-1);return false;" class="btn btn-return">返回</button>  &nbsp;            </div>
            </form>
        </div>


    </div>

</div>
{/block}

{block name="script"}
<script type="text/javascript">
    $(function () {
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        //点击排序
        $('.list_sort').click(function () {
            var url = $(this).attr('url');
            var ids = $('.ids:checked');
            var param = '';
            if (ids.length > 0) {
                var str = new Array();
                ids.each(function () {
                    str.push($(this).val());
                });
                param = str.join(',');
            }

            if (url != undefined && url != '') {
                window.location.href = url + '/ids/' + param;
            }
        });
    });
</script>
{/block}